package com.lcx.movie.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lcx.movie.entity.UserBan;
import com.lcx.movie.mapper.UserBanMapper;
import com.lcx.movie.service.UserBanService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 李丽君
 * @version 1.0
 * @Description 用户封禁实现类
 * @date 2025/3/17 18:27
 */
@Service
public class UserBanServiceImpl extends ServiceImpl<UserBanMapper, UserBan> implements UserBanService {

    /**
     * 新增封禁用户
     * @param userId 用户id
     * @return 受影响的行数
     */
    @Override
    public int insertUserBan(@Param("userId") int userId){
        return this.baseMapper.insertUserBan(userId);
    }
    /**
     * 根据用户id修改封禁状态为申请解封中
     * @param userId 用户id
     * @return 受影响的行数
     */
    @Override
    public int updateUserBan(@Param("userId") int userId){
        return this.baseMapper.updateUserBan(userId);
    }

    /**
     * 根据用户名查询封禁用户
     * @param userName 用户名
     * @return 封禁用户集合
     */
    @Override
    public List<UserBan> selectUserBan(@Param("userName") String userName){
        return this.baseMapper.selectUserBan(userName);
    }
    /**
     * 删除封禁记录
     * @param banId 封禁id
     * @return 受影响的行数
     */
    public int deleteUserBan(@Param("banId") Integer banId){
        return this.baseMapper.deleteUserBan(banId);
    }
}
